package modelimplementation

import "time"

/*
 * 隔周周五支付
 */

type BiweeklySchedule struct {
}

func (bs *BiweeklySchedule) IsPayData(payDate time.Time) bool {
	firstPaydayFriday := time.Date(2001, 11, 9, 0, 0, 0, 0, time.Local)
	timeSpan := payDate.Sub(firstPaydayFriday)
	daySinceFirstPayableFriday := int(timeSpan.Hours()) / 24
	return (daySinceFirstPayableFriday%14) == 0
}

func (bs *BiweeklySchedule) GetPayPeriodStartDate(payPeriodEndDate time.Time) time.Time {
	return payPeriodEndDate.AddDate(0, 0, -13)
}
